import javax.microedition.lcdui.Font;
import javax.microedition.lcdui.Graphics;

public final class aa extends az
        implements br {

    public ar a;
    public byte b;

    public aa(o o1, String s) {
        super(o1, null, s);
        a = new ar(0);
    }

    public final void a(String s) {
        super.a(s);
        b = 0;
    }

    public final int a(int i, int j, int k, int l) {
        b = 0;
        return super.a(i, j, k, l);
    }

    public final void a(Graphics g, bh bh1, o o1, int i, int j) {
        String s;
        boolean flag;
        if (o1.v <= 0 || b == 2) {
            super.a(g, bh1, o1, i, j);
            return;
        }
        s = super.d;
        flag = o1.w != 0;
        if (b == 0 || !bh.b().a((br) this)) {
            if (flag) {
                int k = o1.j.stringWidth(s) - i;
                if (k < 0) {
                    b = 2;
                } else {
                    a.b = o1.v * (k / o1.j.charWidth('x'));
                    a.a(0, k);
                    bh.b().b((br) this);
                    b = 1;
                }
            } else {
                int l = o1.j.stringWidth(s) + i;
                a.b = o1.v * (l / o1.j.charWidth('x'));
                a.a(0, l);
                bh.b().b((br) this);
                b = 1;
            }
        }
        if (b == 2) {
            super.a(g, bh1, o1, i, j);
            return;
        } else {
            g.setColor(super.I.n);
            g.setFont(super.I.j);
            g.drawString(s, (flag ? 0 : i) - a.a, 0, 20);
            return;
        }
    }

    public final int b_(int i) {
        o o1;
        A();
        if (bh.b().a((ba) this) == 0)
            return 0;
        if ((o1 = super.I.a(G())).v <= 0 || b == 2)
            return 0;
        if (a.b(0, i))
            return 200;
        if (o1.w == 0) {
            bh.b().a(this, -3);
            a.a(0, a.d);
        } else {
            a.a(a.d, a.c);
        }
        return 200;
    }
}